#pragma once
#include <vector>

using namespace std;

namespace isPalindrome
{
	class Solution {
	public:
		bool IsValid(char c)
		{
			if ((c >= 'a' && c <= 'z')
				|| (c >= 'A' && c <= 'Z')
				|| (c >= '0' && c <= '9')
				)
			{
				return true;
			}
			return false;
		}
		char LowerCase(char c)
		{
			if (c >= 'A' && c <= 'Z')
			{
				return c + 32;
			}
			return c;
		}
		bool isPalindrome(string s) {
			int left = 0;
			int right = s.length() - 1;
			while (left < right)
			{
				if (!IsValid(s[left]))
				{
					left++;
					continue;
				}
				if (!IsValid(s[right]))
				{
					right--;
					continue;
				}
				if (LowerCase(s[left]) != LowerCase(s[right]))
				{
					return false;
				}
				left++;
				right--;
			}
			return true;
		}
	};
}